<?php

namespace App\Console\Commands;

use App\Models\GoodsOrder;
use Carbon\Carbon;
use Illuminate\Console\Command;


class ShopOrderDeliveryCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'shoporder:delivery';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '商品订单自动发货';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        $now = Carbon::now();
        GoodsOrder::where('order_status', '=', GoodsOrder::ORDER_PAID)
            ->where('delivery_time', '<=', $now)
            ->update(['order_status' => GoodsOrder::ORDER_NOT_RECEIVED]);
    }









}
